import { locales } from './config'

export async function getMessages({ locale }: { locale: string }) {
  // Validate that the incoming `locale` parameter is valid
  if (!locales.includes(locale as any)) locale = 'zh'

  return (await import(`./messages/${locale}.json`)).default
} 